﻿Imports System.Text

Public Class RequiredFieldsException
    Inherits Exception
    Public Sub New(ByVal l As List(Of PropertiesAttributes))
        Dim sb As New StringBuilder()
        sb.AppendLine("Datos obligatorios")
        For Each item In l
            sb.AppendLine(item.RequiredField.Text)
        Next
        _message = sb.ToString()
    End Sub
    Private _message As String
    Public Overrides ReadOnly Property Message() As String
        Get
            Return _message
        End Get
    End Property

End Class


Public Class UniqueFieldsException
    Inherits Exception
    Public Sub New(ByVal l As List(Of PropertiesAttributes))
        Dim sb As New StringBuilder()
        sb.AppendLine("Datos Repetidos: ")
        For Each item In l
            sb.AppendLine(String.Format("El campo: '{0}' con el valor '{1}' ya existe en la base de datos ", item.LabelAtt.Text, item.PropertyValue))
        Next
        _message = sb.ToString()
        Me.ListOfInvalidFields = l
    End Sub
    Public Property ListOfInvalidFields As List(Of PropertiesAttributes)

    Private _message As String
    Public Overrides ReadOnly Property Message() As String
        Get
            Return _message
        End Get
    End Property
    'UniqueField
End Class
